www.gusucode.com > VC++ 模拟演示电站的监控系统-源码程序 > VC++ 模拟演示电站的监控系统-源码程序/code/YbkDemoView.cpp

    //Download by http://www.NewXing.com
// YbkDemoView.cpp : implementation of the CYbkDemoView class
//

#include "stdafx.h"
#include "YbkDemo.h"

#include "YbkDemoDoc.h"
#include "YbkDemoView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CYbkDemoView

IMPLEMENT_DYNCREATE(CYbkDemoView, CView)

BEGIN_MESSAGE_MAP(CYbkDemoView, CView)
	//{{AFX_MSG_MAP(CYbkDemoView)
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CYbkDemoView construction/destruction

CYbkDemoView::CYbkDemoView()
{
	// TODO: add construction code here

}

CYbkDemoView::~CYbkDemoView()
{
}

BOOL CYbkDemoView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CYbkDemoView drawing

void CYbkDemoView::OnDraw(CDC* pDC)
{
	CYbkDemoDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CYbkDemoView printing

BOOL CYbkDemoView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CYbkDemoView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CYbkDemoView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CYbkDemoView diagnostics

#ifdef _DEBUG
void CYbkDemoView::AssertValid() const
{
	CView::AssertValid();
}

void CYbkDemoView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CYbkDemoDoc* CYbkDemoView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CYbkDemoDoc)));
	return (CYbkDemoDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CYbkDemoView message handlers

void CYbkDemoView::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	CRect rect;
	GetClientRect(&rect); 
	HBITMAP hbitmap; 
	hbitmap=::LoadBitmap(::AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_MAIN)); 
	HDC hMenDC=::CreateCompatibleDC(NULL);
	SelectObject(hMenDC,hbitmap);
	::StretchBlt(dc.m_hDC,0,0,1024,768,hMenDC,0,0,1024,768,SRCCOPY);
	::DeleteDC(hMenDC);
	::DeleteObject(hbitmap);
}